/*
 * @LastEditors: zhouyaxue
 * @Date: 2022-09-05 09:58:13
 * @LastEditTime: 2022-12-29 11:05:28
 */
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router';

import routes from './route';
import { updateMetaInfo } from '@/libs/utils';

const router = createRouter({
  // history: createWebHashHistory(),
  history: createWebHistory(),
  routes,
  scrollBehavior() {
    window.scrollTo(0, 100);
  },
});
router.beforeEach((to, from, next) => {
  if (to.meta) {
    updateMetaInfo(to.meta as any);
  }
  window.scrollTo(0, 100);
  next();
});

export default router;
